package com.zhangfei.lambdatest;

public class TestMain {

    private static void getCarName(Car carInterface) {
        System.out.println(carInterface.getCarName());
    }


    public static void main(String[] args) {

        //普通的实现类
        getCarName(new HuaweiCar());


        //匿名内部类
        getCarName(new Car() {
            @Override
            public String getCarName() {
                return "小米汽车";
            }
        });


        //lambda
        getCarName(() -> {
            return "蔚来汽车";
        });


        //lambda简化
        getCarName(() -> "理想汽车");

    }
}
